<?php
/*
 * 提醒事件响应状态自动检测
 */
class Cli_ChkstatusController extends Ctrl_Cli{
    public function indexAction(){
        while(true){
            $tTime = time();
            $tRunlogdir = APPLICATION_PATH . '/shell/runlog/cli_chkstatus.run';
            Tool_Fnc::writefile($tRunlogdir,$tTime);

            $this->opt();
            sleep(5);
        }
        exit;
    }
    private function opt(){
        $p = $_REQUEST;
        $tTime = time();

        $tRPMO = new RemindplanModel;
        $tSql = 'update '.$tRPMO->table.' set status = 2 where status = 0 and respondtime >= '.($tTime-20*60).' and respondtime <= '.$tTime;

        if(!$tRPMO->update($tSql)){
            Tool_Fnc::ajaxMsg('操作失败');
        }
    }
}
?>
